<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link href="<%=request.getContextPath()%>/css/global.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath() %>/js/easyui/themes/metro/easyui.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath() %>/js/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/global.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/easyui/easyui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/ztree/ztree.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/ztree/ztree.excheck.js"></script>
<script type="text/javascript">

$(function(){
	$.fn.zTree.init($("#funTree"), setting, <s:property value="funTree" escape="false"/>);
	var zTree = $.fn.zTree.getZTreeObj("funTree")
	zTree.expandAll(true);
	var nodes = zTree.transformToArray (zTree.getNodes());

	$.getJSON("rof_ajaxrxf.html?rolNo=<s:property value="roleBean.rolNo"/>&time="+Math.random(),
			function(data){
			  $.each(data, function(i,item){
				  var node = zTree.getNodeByParam("funNo", item.funNo);
           	  		 zTree.checkNode(node,true,true);
			});
		}); 
});
var setting = {
	check: {
		autoCheckTrigger:true,
		enable: true,
		chkboxType :{
			"Y" : "",
			"N" : ""
			}
	},
	data: {
		key:{
			name:'funName',
			title:'funName'
		},
		simpleData: {
			enable: true,
			idKey:'funNo',
			pIdKey:'funDad',
			rootPid:-1
		}
	},
	callback: {
		onCheck: function(e, treeId, treeNode) {
			if(treeNode.checked){
				$.ajax({
					   type: "POST",
					   cache: false,
					   async: false,
					   url: "rof_saverxf.html",
					   data: "rolNo=<s:property value="roleBean.rolNo"/>&funNo="+treeNode.funNo+"&time="+Math.random(),
					   success: function(msg){
					     
					   }
					}); 
			}else{
				$.ajax({
					   type: "POST",
					   cache: false,
					   async: false,
					   url: "rof_moverxf.html",
					   data: "rolNo=<s:property value="roleBean.rolNo"/>&funNo="+treeNode.funNo+"&time="+Math.random(),
					   success: function(msg){
					     
					   }
					}); 
			}
		}	
	}
};

</script>
</head>
<body >
 	<div class="easyui-panel" title="关联面板" style="width:100%;" data-options="fit:true">
		<table width="600" border="0" style="margin: 5px;">
		<tr><td height="25" colspan="2"><b>操作说明:对角色进行功能权限分配后,可以在配置操作员时进行模版套用</b></td></tr>
		<tr>
		<tr>
		<td width="40%" valign="top">
			<table width="100%" border="0">
				<tr><td height="25">角色名称 : <s:property value="roleBean.rolName"/></td></tr>
			</table>
		</td>
		
		<td width="60%" valign="top">
			<table width="100%"  border="0">
				<tr><td height="25">点选功能项即生效</td></tr>
				<tr>
				<td height="25">
					<ul id="funTree" class="ztree"></ul>
				</td>
				</tr>
			</table>
		</td>
		</tr>
		<tr>
			<td colspan="2" >
				<input type="button" class="submit" value="返回前页" onclick="location.href='<%=request.getContextPath()%>/rof_listrole.html'">
			</td>
		</tr>
	</table>
		
	</div>
</body>
</html>

